// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlPrepareStatement.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"
#include "../../../../ast/SQLObject.h"
#include "../../visitor/MySqlASTVisitor.h"

MySqlPrepareStatement::MySqlPrepareStatement()
{
}

MySqlPrepareStatement::MySqlPrepareStatement(SQLName_ptr name, SQLExpr_ptr from)
{
  this->name = name;
  this->from = from;
}

SQLName_ptr MySqlPrepareStatement::getName()
{
  return name;
}

void MySqlPrepareStatement::setName(SQLName_ptr name)
{
  this->name = name;
}

SQLExpr_ptr MySqlPrepareStatement::getFrom()
{
  return from;
}

void MySqlPrepareStatement::setFrom(SQLExpr_ptr from)
{
  this->from = from;
}

void MySqlPrepareStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlPrepareStatement)))
  {
    acceptChild(visitor, name);
    acceptChild(visitor, from);
  }
  visitor->endVisit(SharedObject(MySqlPrepareStatement));
}

// @Override
SQLObject_list_ptr MySqlPrepareStatement::getChildren()
{
  SQLObject_list_ptr children = std::make_shared<std::list<SQLObject_ptr>>();
  if (name != nullptr)
  {
    children->push_back(name);
  }
  if (this->from != nullptr)
  {
    children->push_back(from);
  }
  return children;
}
